<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
   const arr1 = [1, 5, 8,88,100,23] 
   const arr2 = [2,124,66,77,88,999] 

   function getnumber(arr1) {
    return[(Math.max(...arr1)),(Math.min(...arr1))]   
  }
   console.log(getnumber(arr1));
   console.log(getnumber(arr2));
  </script>
</body>
</html>